<script setup lang="ts">
const { prop, value } = defineProps({
  prop: {
    type: String,
    required: false,
    default: 'Name',
  },
  value: {
    type: Object,
    default: () => ({}),
  },
})

const showLabel = computed(() => {
  let str = ''
  if (value) {
    function processLabel(item: any) {
      str = item[prop] + str
      item.Parent && processLabel(item.Parent)
    }
    processLabel(value)
  }
  return str
})
</script>

<template>
  <span>{{ showLabel }}</span>
</template>
